{block name='content'}
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body padding-left-40">
        <div class="layui-form-item layui-row layui-col-space15">
            <div class="layui-col-xs12 block relative">
                <span class="color-green label-required-prev">模式标题</span><span class="margin-left-5 color-desc">Mode·Title</span>
                <input class="layui-input" name="title" value="{$vo.title|default=''}" placeholder="请输入计费模式标题">
            </div>
        </div>

        <div class="layui-form-item layui-row layui-col-space15">
            <div class="layui-col-xs6 block relative">
                <span class="color-green label-required-prev">选择柜点</span><span class="margin-left-5 color-desc">Fee Type</span>
                <select {if isset($vo.store_id)}disabled{/if} class="layui-select" lay-verify="required" required lay-search lay-filter="store_id" id="store_id" name="store_id">
                    <option selected value="">请选择 柜点</option>
                    {foreach $stores as $key=>$type}
                    {if isset($vo.store_id) AND $vo.store_id eq $key}
                    <option selected value="{$key}">{$type}</option>
                    {else}
                    <option value="{$key}" {if in_array($key, $use_stores)}disabled=""{/if}>{$type}</option>
                    {/if}
                    {/foreach}
                </select>
            </div>

            <div class="layui-col-xs6 block relative">
                <span class="color-green label-required-prev">收费类型</span><span class="margin-left-5 color-desc">Fee Type</span>
                <select class="layui-select" lay-verify="required" required lay-search lay-filter="fee" id="fee_type" name="fee_type">
                    <option selected value="">请选择 收费类型</option>
                    {foreach $fee_types as $key=>$type}
                    {if isset($vo.fee_type) AND $vo.fee_type eq $key}
                    <option selected value="{$key}">{$type}</option>
                    {else}
                    <option value="{$key}">{$type}</option>
                    {/if}
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-row layui-col-space15">
            <div class="layui-col-xs12 block">
                <span class="color-green">收费说明</span><span class="margin-left-5 color-desc">Fee description</span>
                <textarea class="layui-form layui-textarea" rows="3" cols="3" name="summary">{$vo.summary|default=''}</textarea>
            </div>
        </div>



        <div class="layui-form-item layui-row layui-col-space15 layui-hide" id="feeDetail">
            <div class="layui-col-xs12 block relative">
                <table class="layui-table margin-top-10">
                    <thead>
                        <th></th>
                        <th class="text-center">柜子类型</th>
                        <th class="text-center">单价</th>
                        <th class="text-center">最大天数</th>
                        <th class="text-center">超时费用</th>
                        <th class="text-center">显示内容</th>
                    </thead>
                    <tbody>

                    {foreach $box_types as $key=>$val}
                    <tr>
                        <td>{$key}</td>
                        <td>
                            <input class="layui-input" readonly value="{$val}">
                            <input type="hidden" name="detail[]" value="{:isset($vo.fee_detail[($key-1)*5])?$vo.fee_detail[($key-1)*5]:$key}">
                        </td>
                        <td>
                            <input class="layui-input" name="detail[]" value="{:isset($vo.fee_detail[($key-1)*5+1])?$vo.fee_detail[($key-1)*5+1]:''}" placeholder="请输入 单价">
                        </td>
                        <td>
                            <input class="layui-input" name="detail[]" value="{:isset($vo.fee_detail[($key-1)*5+2])?$vo.fee_detail[($key-1)*5+2]:''}" placeholder="请输入 最大天数">
                        </td>
                        <td>
                            <input class="layui-input" name="detail[]" value="{:isset($vo.fee_detail[($key-1)*5+3])?$vo.fee_detail[($key-1)*5+3]:''}" placeholder="请输入 超时费用">
                        </td>
                        <td>
                            <input class="layui-input" name="detail[]" value="{:isset($vo.fee_detail[($key-1)*5+4])?$vo.fee_detail[($key-1)*5+4]:''}" placeholder="请输入 显示内容">
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
        </div>

        <div class="layui-form-item layui-row layui-col-space15 layui-hide" id="feeDetail1">
            <div class="layui-col-xs12 block relative">
                <table class="layui-table margin-top-10">
                    <thead>
                    <th></th>
                    <th class="text-center">柜子类型</th>
                    <th class="text-center">预付</th>
                    <th class="text-center">单价</th>
                    <th class="text-center">免费小时</th>
                    <th class="text-center">最大收费</th>
                    <th class="text-center">显示内容</th>
                    </thead>
                    <tbody>
                    {foreach $box_types as $key=>$val}
                    <tr>
                        <td>{$key}</td>
                        <td>
                            <input class="layui-input" readonly value="{$val}">
                            <input type="hidden" name="detail1[]" value="{:isset($vo.fee_detail1[($key-1)*6])?$vo.fee_detail1[($key-1)*6]:$key}">
                        </td>
                        <td>
                            <input class="layui-input" name="detail1[]" value="{:isset($vo.fee_detail1[($key-1)*6+1])?$vo.fee_detail1[($key-1)*6+1]:''}" placeholder="请输入 预付">
                        </td>
                        <td>
                            <input class="layui-input" name="detail1[]" value="{:isset($vo.fee_detail1[($key-1)*6+2])?$vo.fee_detail1[($key-1)*6+2]:''}" placeholder="请输入 单价">
                        </td>
                        <td>
                            <input class="layui-input" name="detail1[]" value="{:isset($vo.fee_detail1[($key-1)*6+3])?$vo.fee_detail1[($key-1)*6+3]:''}" placeholder="请输入免费小时">
                        </td>
                        <td>
                            <input class="layui-input" name="detail1[]" value="{:isset($vo.fee_detail1[($key-1)*6+4])?$vo.fee_detail1[($key-1)*6+4]:''}" placeholder="请输入最大收费">
                        </td>
                        <td>
                            <input class="layui-input" name="detail1[]" value="{:isset($vo.fee_detail1[($key-1)*6+5])?$vo.fee_detail1[($key-1)*6+5]:''}" placeholder="请输入显示内容">
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
        </div>

    </div>
    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center" style="padding-bottom: 20px;">
        <button class="layui-btn" lay-submit lay-filter="submit">保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-close="">取消编辑</button>
    </div>

</div>

</form>
{/block}

{block name='script'}
<script>
    (function () {
        var title = "{$title}";
        if(title=='查看设备'){
            $("input,select").attr("readOnly", true);
        }

        apply({value: $("#fee_type").val()});
        layui.form.on('select(fee)', apply);

        function apply(data) {
            if(data.value==3){
                $("#feeDetail").addClass('layui-hide');
                $("#feeDetail1").removeClass('layui-hide');
            }else if(data.value==2){
                $("#feeDetail1").addClass('layui-hide');
                $("#feeDetail").removeClass('layui-hide');
            }else{
                $("#feeDetail").removeClass('layui-hide').addClass('layui-hide');
                $("#feeDetail1").removeClass('layui-hide').addClass('layui-hide');
            }
        }

        layui.form.render();

    })();
</script>
{/block}